from math import sqrt

base = 600851475143
largest = 0
def getf(n):
	f = 0
	for x in range(2,int(sqrt(n))+1):
		if n % x == 0:
			f = 1
	return f

for x in range(1,int(sqrt(base))+1):
	if getf(x) == 0 and base % x == 0:
		print(x)
		largest = x

print(largest)